<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <ul>
        

    </ul>
    <script>
        // 获取ul
        let ul = document.getElementsByTagName('ul')[0]
        console.log(ul);
        // ul.innerHTML ='<li>111111</li>'
        // 创建元素
        let li = document.createElement('li')
        li.innerHTML=123456
        // 插入元素
        ul.appendChild(li)

        console.log(li);
        

        for (let index = 0; index <6; index++) {
           let li = document.createElement('li')
           li.innerHTML=index
            //  插入元素
           ul.appendChild(li)
           ul.innerHTML += `<li>${index}</li>`
        }
    </script>
</body>
</html>